<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class RecordRemarkRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        switch ($this->method()) {
            case 'POST':
                $rules =  [
                    'status' => [
                        'required',
                        Rule::in(['成功回访','停机','关机','空号','无人接听','直接挂掉','用户正忙','不在服务区']),
                    ],
                    'record_id'=>'required|exists:phone_records,id'
                ];
                break;
            case 'PATCH':
                $rules =  [
                    'status' => [
                        'required',
                        Rule::in(['成功回访','停机','关机','空号','无人接听','直接挂掉','用户正忙','不在服务区']),
                    ],
                ];
                break;
        }

        return $rules;
    }
}
